// MulticastChat.h
#ifndef MULTICASTCHAT_H
#define MULTICASTCHAT_H

#include <QThread>
#include <QString>
#include <QListView>

#include <winsock2.h>
#include <ws2tcpip.h>

class MulticastChat : public QThread
{
    Q_OBJECT

public:
    MulticastChat();
    ~MulticastChat();

    bool startChat();
    void stopChat();
    void sendMessage(const QString& message);

signals:
    void recvData(const QString& message);

private:
    void run();
    void receiveMessages();

private:
    SOCKET sock;
    sockaddr_in local;
    sockaddr_in remote;
    std::thread receiverThread;
};

#endif // MULTICASTCHAT_H
